<template>
  <Card title="单位信息" :padding="[32]" :show-divider="false">
    <view class="hb-mt-3">
      <view v-for="(item, index) in botCompanyInfoVoList" :key="index">
        <view class="hb-flex hb-items-center hb-gap-3 hb-py-3">
          <view>
            <TImage width="80rpx" height="80rpx" error-img-type="unit" :src="item.logo" />
          </view>
          <view class="hb-flex-1">
            <view class="hb-text-sm hb-font-bold hb-mb-2">{{ item.name }}</view>
            <RoleTag type="superAdmin" :text="item.position" />
          </view>
          <view>
            <tm-button
              type="primary"
              :outlined="true"
              :width="80"
              :height="48"
              :margin="[0]"
              :round="10"
              label="详情"
              :font-size="24"
              @click="handleCompanyDetail(item)"
            ></tm-button>
          </view>
        </view>
      </view>
    </view>
  </Card>
</template>

<script setup lang="ts">
  import { BotCompanyInfo } from '@/api/card/type';
  import Card from '../../components/Card/index.vue';

  interface CompanyInfoProps {
    botCompanyInfoVoList: BotCompanyInfo[];
  }

  defineProps<CompanyInfoProps>();

  const handleCompanyDetail = (item: BotCompanyInfo) => {
    navigateTo({
      name: 'companyDetail',
      options: {
        uuid: item.uuid!,
      },
    });
  };
</script>
